#!/usr/bin/env python 
# encoding: utf-8 

"""
@version: v1.0
@author: xover
@contact: xe333@sina.com
@software: PyCharm
@file: 来十句名言.py
@time: 2020/6/2 0002 17:46
"""
import random
import ssl
import time
import threading
import requests

import time

exitFlag = 0


print("Exiting Main Thread")
vol_type_list = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l"]
item_list = ["动画", "漫画", "游戏", "文学", "原创", "来自网络", "其他", "影视", "诗词", "网易云", "哲学", "抖机灵"]


# def time_clock():
#     stopevt = threading.Event()
#     time.sleep(5)
#     thread1 = threading.Thread(target=input_type)
#     thread1.start()
#     stopevt.set()
#
# def input_type():
#
#     return vol_type


# vol_type = input_type()
vol_type = 'k'
while True:
    for num in range(20):
        welcoming = 'http://v1.jinrishici.com/rensheng'
        ssl._create_default_https_context = ssl._create_unverified_context
        # note = requests.get(url=welcoming, params={'c': vol_type}, verify=True).json()
        note = requests.get(url=welcoming, verify=True).json()
        # print(note)
        welcome = '名言 %2s ------>>' % (num + 1) + note['content']
        print(welcome)
    while True:
        vol_type = 'e'
        for i in range(len(item_list)):
            print('%s: %s' % (i + 1, item_list[i]))
        vol_type_index = input('请输入名言类型：')
        try:
            vol_type_index = int(vol_type_index)
        except Exception:
            print('Wrong input!')
            continue
        try:
            vol_type = vol_type_list[vol_type_index - 1]
            break
        except Exception:
            print('Wrong input!')
            continue
